#include <stdio.h>

int main()
{
    FILE* fp = fopen("log.txt", "a");
    if (NULL == fp)
    {
        perror("fopen");
        return -1;
    }

    //向文件流中打印
    fprintf(fp, "%d, %d", 1, 2);
    printf("fd: %d\n", fp->_fileno);
    printf("fd: %d\n", fileno(fp));//更规范, 通用

    fclose(fp);

    return 0;
}
